//
//  Student.m
//  Oc02_实例变量可见度_方法
//
//  Created by dllo on 16/2/25.
//  Copyright © 2016年 Apon. All rights reserved.
//

#import "Student.h"

@implementation Student

#pragma mark - init

-(instancetype)init{

    self = [super init];
    if (self) {
        _classroomName = @"160101";
    }
    return self;
}
#pragma mark - 重写父类方法
/**
 * 重写父类方法时,父类方法不用再.h文件中声明,直接在.m文件中实现即可
 */
- (void)sayHi{
    /** 
     * super 是编译器指令,指调用父类方法.
     * [super sayhi] 是当前对象调用父类的sayhi方法,而不是父类对象调用sayhi的方法.
     */
    [super sayHi];
    NSLog(@"grade:%f, classroomName:%@", _grade, _classroomName);
}
#pragma mark - setter getter
- (void)setGrade:(float)grade{
    _grade = grade;
}
- (float)grade{
    return _grade;
}
- (void)setclassroomName:(NSString *)classroomName{
    _classroomName = classroomName;
}
- (NSString *)className{
    return _classroomName;
}
@end
